package com.angel.service.ServiceImpl;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

import com.angel.bean.EmployeeType;
import com.angel.mapper.EmployeeTypeDao;
import com.angel.service.EmployeeTypeService;

@Service
public class EmployeeTypeServiceImpl implements EmployeeTypeService {

    @Resource
    private EmployeeTypeDao employeeTypeDao;

    @Override
    public int insert(EmployeeType employeeType) {
        return employeeTypeDao.insert(employeeType);
    }

    @Override
    public int insertSelective(EmployeeType employeeType) {
        return employeeTypeDao.insertSelective(employeeType);
    }

    @Override
    public int insertList(List<EmployeeType> employeeTypes) {
        return employeeTypeDao.insertList(employeeTypes);
    }

    @Override
    public int update(EmployeeType employeeType) {
        return employeeTypeDao.update(employeeType);
    }

    @Override
    public List<EmployeeType> findEmployeeType(EmployeeType employeeType) {
        return employeeTypeDao.findEmployeeType(employeeType);
    }

    @Override
    public EmployeeType findOneType(EmployeeType employeeType) {
        List<EmployeeType> list = this.findEmployeeType(employeeType);
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }

    @Override
    public int delEmployeeType(EmployeeType employeeType) {
        if (employeeType.getEmTypeId() != null) {
            return employeeTypeDao.delEmployeeType(employeeType);
        }
        return 0;
    }
}
